package com;

import com.einwin.framework.utils.SpringUtils;
import com.microservice.demo.client.DemoClient;
import com.microservice.demo.api.InputParameter;
import com.microservice.demo.client.service.DemoService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;

/**
 * Created by fqiang on 4/24/17.
 */

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ServiceCaller {

//    public void caller() {
//        InputParameter x = new InputParameter();
//        x.setName("b1b1b");
//        x.setId(1);
////        DemoService service = (DemoService) SpringUtils.getBean("com.microservice.demo.client.service.DemoService");
////        System.out.println(service);
////        service.index(x);
//
//        DemoClient client = SpringUtils.getBean(DemoClient.class);
//
//        System.out.println(client);
//        client.index(x);
////        DemoClient.index(x);
//    }

    public static void main(String[] args){
        System.out.println("Application out");
        SpringApplication.run(ServiceCaller.class,args);
        DemoService service = (DemoService) SpringUtils.getBean("com.microservice.demo.client.service.DemoService");
        System.out.println(service);

        InputParameter x = new InputParameter();
        x.setName("b1b1b");
        x.setId(1);
//        System.out.println(client);
        DemoClient.index(x);

    }
}
